
%Load Data

[data,varnames,RAW] = xlsread('data_national.xlsx','Sheet1','A2:L239');
for i=1:size(data,2)
    eval([varnames{1,1+i} '=data(:,' num2str(i) ');']);
end


%% Load dta file
%load data_update_v3

%%% Estimation Parameters
p = 2;              % Number of lags
n_step = 200;        % Periods to Compute for IRF
paramuc=0;  %%Paramater Uncertainty
savepic=1;
savexls=1; 
n_rot_acc=100;  % default = 5000
grdiff=1; %1=>qoq growth rates, where growth rates are calculated 

tau = 0;            % Flat Prior
lev = 0.16;         % 16-84th Percentile  Error band
nlags=p;


DateZero='Q4-1996'; % Start of the Boom
BoomEnd='Q1-2006';  % End of the Boom
BustEnd='Q1-2012';  % End of the Bust

%Horizon for Sign Restrictions
LL=1;   
KK=2;


%%Define Variables
define_vars


y=[(log(rgdp_sa_bill(start:end))-log(rgdp_sa_bill(start-grdiff:end-grdiff)))*100  (log(price_r(start:end))-log(price_r(start-grdiff:end-grdiff)))*100  log(rent_price_ratio(start:end))*100  ...
   log_perm(start:end) mortgage_rate(start:end) total_yr_vac(start:end) hh_form];
series = {'GDP', 'House price ','Rent-to-price ratio','Building permits','Mortgage rate','Vacancy rate','HH Formation'};
varname = {'GDP','House','Rent-to-price','Building','Mortgage','Vacancy', 'HH';
            'level','price level','ratio','permits', 'rate', 'rate', 'formation'};

%Order of variables
n_gdp = 1;
n_price =2;   
n_rent_price =3;         
n_perm  = 4;     
n_mrate = 5;       
n_total_vac =6;
n_hh_form = 7;